package com.fivefu.core.camera.services.impl;

import com.fivefu.core.camera.services.EventTypeService;
import com.fivefu.module.event.entity.response.DbAiEventTypeRes;
import com.fivefu.module.event.services.DbAiEventTypeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class EventTypeServiceImpl implements EventTypeService {

    @Autowired
    private DbAiEventTypeService dbAiEventTypeService;

    /**
     * 通过案卷类型编号查询案卷类型详情
     * @param code 案卷类型编号
     * @return
     */
    @Override
    public DbAiEventTypeRes queryEventTypeByCode(String code){
        DbAiEventTypeRes eventType = dbAiEventTypeService.queryEventTypeDetailByCode(code, null);
        return eventType;
    }

    /**
     * 通过案卷类型编号查询数字城管案卷类型编号
     * @param code 案卷类型编号
     * @return
     */
    @Override
    public String queryEventTypeCodeByCode(String code){
        DbAiEventTypeRes eventType = queryEventTypeByCode(code);
        if (eventType != null){
            return eventType.getEventTypeCode();
        }
        return null;
    }

    /**
     * 通过案卷类型编号查询类型名称
     * @param code 案卷类型编号
     * @return
     */
    @Override
    public String queryEventTypeNameByCode(String code){
        DbAiEventTypeRes eventType = queryEventTypeByCode(code);
        if (eventType != null){
            return eventType.getEventTypeName();
        }
        return null;
    }

}
